package cn.chenxi.hadoopproject.monthWeather.controller;

import cn.chenxi.hadoopproject.base.response.JsonResult;
import cn.chenxi.hadoopproject.monthWeather.pojo.dto.MonthWeatherQuery;
import cn.chenxi.hadoopproject.monthWeather.pojo.vo.MonthWeatherVO;
import cn.chenxi.hadoopproject.monthWeather.service.MonthWeatherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/v1/monthWeather")
@Api(tags = "查询月天气情况")
public class MonthWeatherController {
    @Autowired
    private MonthWeatherService monthWeatherService;

    @GetMapping("/select")
    @ApiOperation("查找对应城市对应年份的月天气情况")
    public JsonResult select(MonthWeatherQuery monthWeatherQuery) {
        List<MonthWeatherVO> monthWeatherVOS = monthWeatherService.select(monthWeatherQuery);
        return JsonResult.ok(monthWeatherVOS);
    }
}
